{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-11-17T08:17:36.910451Z",
     "start_time": "2025-11-17T08:17:36.904824Z"
    }
   },
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "date_ser = pd.Series([12,56,89,99,31])\n",
    "date_ser"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    12\n",
       "1    56\n",
       "2    89\n",
       "3    99\n",
       "4    31\n",
       "dtype: int64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-17T08:17:39.765874Z",
     "start_time": "2025-11-17T08:17:39.741699Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from pandas.tseries.offsets import *\n",
    "date_offset = Week(2) + Hour(10)\n",
    "pd.date_range('2023/1/1','2023/1/31',freq=date_offset)"
   ],
   "id": "a82e61061eead67f",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2023-01-01 00:00:00', '2023-01-15 10:00:00',\n",
       "               '2023-01-29 20:00:00'],\n",
       "              dtype='datetime64[ns]', freq='346h')"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-17T08:32:57.865334Z",
     "start_time": "2025-11-17T08:32:57.850153Z"
    }
   },
   "cell_type": "code",
   "source": [
    "period_index = pd.period_range('2023.1.8','2023.5.31',freq='M')\n",
    "period_index"
   ],
   "id": "4bc52cba456b5e3b",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PeriodIndex(['2023-01', '2023-02', '2023-03', '2023-04', '2023-05'], dtype='period[M]')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-17T08:33:13.726859Z",
     "start_time": "2025-11-17T08:33:13.720734Z"
    }
   },
   "cell_type": "code",
   "source": [
    "str_list = ['2021','2022','2023']\n",
    "pd.PeriodIndex(str_list, freq='Y-DEC')"
   ],
   "id": "b07b5f7c75da55c4",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PeriodIndex(['2021', '2022', '2023'], dtype='period[Y-DEC]')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-17T08:36:54.861399Z",
     "start_time": "2025-11-17T08:36:54.851331Z"
    }
   },
   "cell_type": "code",
   "source": [
    "period_ser = pd.Series(np.arange(5), period_index)\n",
    "period_ser"
   ],
   "id": "7fe8b74b4d4efc64",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2023-01    0\n",
       "2023-02    1\n",
       "2023-03    2\n",
       "2023-04    3\n",
       "2023-05    4\n",
       "Freq: M, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "fc3e065d92ff04d6"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
